package cn.leaf.state;

/**
 *
 * desc: 订单实体
 *
 * @author twinkle-leaf
 * @version v1.0.0
 * @since 2021-03-21 00:04:39
 * slogan: There are no two identical leaves in the world.🍃
 *
 */
public class Order {
    private int id;
    private String name;
    private double price;
    private OrderState state;

    public Order(int id, String name, double price) {
        this.id = id;
        this.name = name;
        this.price = price;
        this.state = new UnconfirmedState();
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public OrderState getState() {
        return state;
    }

    public void setState(OrderState state) {
        this.state = state;
    }

    public void confirm() {
        state.confirm(this);
    }

    public void cancel() {
        state.cancel(this);
    }

    public void ship() {
        state.ship(this);
    }
}
